1
using System
.Collections
;
2 using System
.Collections
.Generic
;
5 using UnityEngine
.SceneManagement
;
6 using UnityEngine
.EventSystems
;
8 public class LevelSelection
: MonoBehaviour
{
10 public int selectedLevel
;
11 [SerializeField
] GameObject m_ConfirmationPanel
;
12 [SerializeField
] GameObject m_CancelButton
;
13 [SerializeField
] GameObject SelectionPanel
;
14 [SerializeField
] GameObject Level0Button
;
15 private GameObject
[] menuManagers
;
16 private MenuManager menuManagerScript
;
21 m_ConfirmationPanel
.SetActive(false);
22 menuManagers
= GameObject
.FindGameObjectsWithTag ("MenuManager");
25 public void SelectLevel0()
28 SelectionPanel
.SetActive(false);
29 m_ConfirmationPanel
.SetActive(true);
30 EventSystem
.current
.SetSelectedGameObject(m_CancelButton
,null);
33 public void SelectLevel1()
36 SelectionPanel
.SetActive(false);
37 m_ConfirmationPanel
.SetActive(true);
38 EventSystem
.current
.SetSelectedGameObject(m_CancelButton
,null);
42 public void SelectLevel2()
45 SelectionPanel
.SetActive(false);
46 m_ConfirmationPanel
.SetActive(true);
47 EventSystem
.current
.SetSelectedGameObject(m_CancelButton
, null);
53 public void SelectLevelBoss()
56 SelectionPanel
.SetActive(false);
57 m_ConfirmationPanel
.SetActive(true);
58 EventSystem
.current
.SetSelectedGameObject(m_CancelButton
,null);
62 public void GoToSelectedLevel()
64 switch (selectedLevel
)
68 SceneManager
.LoadScene("Level0");
72 SceneManager
.LoadScene("Level1");
76 SceneManager
.LoadScene("Level2a");
80 SceneManager
.LoadScene("Level3");
85 public void GoBackToSelection()
87 m_ConfirmationPanel
.SetActive(false);
88 SelectionPanel
.SetActive(true);
89 EventSystem
.current
.SetSelectedGameObject(Level0Button
,null);
92 public void GobackToCharacterSelection()
94 SceneManager
.LoadScene("CharacterSelection");
97 public void DestroyMenuMusic()
99 foreach (GameObject manager
in menuManagers
)
101 menuManagerScript
= manager
.GetComponent
<MenuManager
> ();
102 if (menuManagerScript
.IsMenuMusicPlaying ())
104 menuManagerScript
.StopMenuMusic ();